<?php

namespace App\Http\Requests\Namecard;

use App\Http\Requests\AbstractApiRequest;
use Dingo\Api\Http\FormRequest;
use Illuminate\Validation\ValidationException;

class Update extends AbstractApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'sometimes|required',
            'job' => 'sometimes|required',
            'telphone' => 'sometimes|required',
            'mobile' => 'sometimes|required',
            'email' => 'sometimes|required',
            'firm_name' => 'sometimes|required'
        ];
    }

    /**
    * 获取已定义验证规则的错误消息。
    *
    * @return array
    */
    public function messages()
    {
        return [
            'name.required' => '姓名不能为空',
            'job.required' => '职务不能为空',
            'telphone.required' => '座机号不能为空',
            'mobile.required' => '手机号不能为空',
            'email.required' => '邮件不能为空',
            'firm_name.required' => '单位名称不能为空'
        ];
    }
}
